function TrainAndTest(experiment_Index,conn, colNames, reducedData,runParams, SVMParams)
analytes =unique( reducedData(:,1) );

kernalProps=CopyKernalParameters(SVMParams);%DefaultKernalParameters();
kernalProps.nbclass =length(analytes);

if runParams.Remove_Common_Peaks==1
    commonSVMParams=DetermineCommon(analytes,reducedData,runParams, SVMParams);
else
    commonSVMParams=[];
end

if runParams.Remove_Anomaly ==1
    anomalySVMParams=DetermineAnomaly(analytes,reducedData,runParams, SVMParams);
else
    anomalySVMParams=[];
end
disp('filtering');
[filteredData, lostPercent] = FilterData(analytes,reducedData, anomalySVMParams, commonSVMParams );

Labels =filteredData(:,1);
for I=1:length(analytes)
    Labels(Labels==analytes(I))=200+I;
end
Labels =Labels-200;

idx = randperm(size(filteredData,1),length(analytes)*400);
Training = filteredData(idx,4:end);
LabelsTraining = Labels(idx);

genericSVM= CopyKernalParameters(SVMParams);
genericSVM.nbclass = length(analytes);
disp('training');
[ allPeaksSVM, trainingAccuracy]=  CreateMultiClass(Training,LabelsTraining,genericSVM);

allPeaksSVM.kernalProps = genericSVM;

disp(trainingAccuracy);

idx = randperm(size(filteredData,1),length(analytes)*400);
Testing = filteredData(idx,4:end);
LabelsTesting = Labels(idx);
predictedGroup  = svmmultivaloneagainstone(Testing,allPeaksSVM.xsup,allPeaksSVM.w,allPeaksSVM.b,allPeaksSVM.nbsv,allPeaksSVM.kernel,allPeaksSVM.kerneloption);

accur = sum( predictedGroup==LabelsTesting)/ length(predictedGroup)*100;
fprintf ('%f3\n', accur);



sql =['INSERT INTO SVM_Results SET SVM_Experiment_Index =' num2str(experiment_Index) ...
      ', SVM_parameters=''' sprintf('%s,', colNames{1:end}) ''''  ...
      ', SVM_Training_Accuracy=' num2str(trainingAccuracy) ...
      ',SVM_Testing_Accuracy=' num2str(accur) ...
      ',SVM_LostPoints=' num2str(lostPercent) ];

exec(conn,sql);  
  
  
end